<link rel="stylesheet" type="text/css" media="all" href="/static/assets/css/daterangepicker-bs3.css" />

<!--<script type="text/javascript" src="/static/assets/js/jquery-1.8.3.min.js"></script>-->
<!--<script type="text/javascript" src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>-->
<script type="text/javascript" src="/static/assets/js/moment.js"></script>
<script type="text/javascript" src="/static/assets/js/daterangepicker.js"></script>


<div class="page-content">
    <div class="page-header">
        <h1>
            记录
            <small>
                <i class="ace-icon fa fa-angle-double-right"></i>
                {$title}
            </small>
        </h1>
    </div><!-- /.page-header -->

    <div class="row">
        <from class="form-horizontal user-data" role="form">
            <div class="form-group">
                <div class="col-md-5 no-margin-right no-padding-right">
                    <label class="col-sm-4 control-label no-padding-right" for="form-field-1"> 电话: </label>
                    <input type="text" name="phone" placeholder="电话号码" class="col-sm-6" value="">
                </div>
                <input type="hidden" value="{$id}" name="id">
                <button type="submit" id="searchBtn" style="margin-left: 30px;" class="dt-button buttons-collection buttons-colvis btn btn-white btn-primary btn-bold" tabindex="0" aria-controls="dynamic-table" data-original-title="" title="查询"><span><i class="fa fa-search bigger-110 blue"></i></span></button>
            </div>
        </from>
    </div><!-- /.row -->

    <div class="row">
        <div class="col-xs-12">
            <table id="simple-table" class="table  table-bordered table-hover">
                <thead>
                <tr>
                    <th class="detail-col center">UID</th>
                    <th class="detail-col center">手机</th>
                    <th class="center">数量</th>
                    <th class="center">时间</th>
                    <th class="center">详情</th>
                </tr>
                </thead>

                <tbody>
                {volist name = 'list' id = 'val'}
                <tr  class="center">
                    <td>{$val -> uid}</td>
                    <td>{$val -> McMembers -> EweiShopMember -> Shareholders -> phone}</td>
                    <td>{$val -> num}</td>
                    <td>{$val -> createtime}</td>
                    <td>{$val -> remark}</td>
                </tr>
                {/volist}
                </tbody>
            </table>
            {$page_html['html']}
        </div><!-- /.span -->
    </div><!-- /.row -->
</div>

<script>
    $(function () {
        $("#searchBtn").click(function () {
            console.log(1111);
            var reg = /^1[3578]\d{9}$/;
            var phone = $('input[name="phone"]').val();
            var is_date = $("#is_date").is(':checked');
            var date = $("#search_date").val();
            var text_href = '';

            if(reg.test(phone)){
                text_href += "phone="+phone;
            }
            if(is_date){
                if(!text_href){
                    text_href += "date="+date;
                }else{
                    text_href += "&date="+date;
                }
            }
            if(text_href){
                text_href = "?"+text_href;
            }

            location.href=location.href.split('?')[0]+text_href;
        });

        $(".showBtn").click(function () {
            var id = $(this).attr('mark');
            var date = $(this).parents('tr').find(".dateval").text().split(' ')[0];
            var url = "{:url('performance/detail')}";
            url = url + '?sid='+id+"&date="+date;

            layer.open({
                type: 2,
                title: false,
                shade: [0],
                area: ['1200px', '600px'],
                offset: 'auto', //右下角弹出
                shift: 2,
                content:url

            });
        });
    })

